home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / X11 / wais / waisgate / ztype1.h < prev    next >
C/C++ Source or Header  |  1995-05-09  |  4KB  |  148 lines

  1. /* WIDE AREA INFORMATION SERVER SOFTWARE:
  2.    No guarantees or restrictions.  See the readme file for the full standard
  3.    disclaimer.    
  4.   
  5.    3.26.90    Harry Morris, morris@think.com
  6.    4.14.90  HWM - changed symbol for boolean query from QT_1 to 
  7.                      QT_BooleanQuery
  8. */
  9.  
  10. /*----------------------------------------------------------------------*/
  11. /* This file implements the type 1 query defined in appendices B & C
  12.    of the SR 1 spec.
  13.  */
  14. /*----------------------------------------------------------------------*/
  15.  
  16. #ifndef _H_Type_1_Query_
  17. #define _H_Type_1_Query_
  18.  
  19. #include "cdialect.h"
  20.  
  21. #include "zutil.h"
  22.  
  23. /*----------------------------------------------------------------------*/
  24. /* types and constants */
  25.  
  26. /* new data tags */
  27. #define    DT_AttributeList    (data_tag)44
  28. #define DT_Term            (data_tag)45
  29. #define DT_Operator        (data_tag)46
  30.  
  31. #define QT_BooleanQuery    "1"        /* standard boolean query */
  32.  
  33. /* general attribute code - use in place of any attribute */
  34. #define IGNORE    "ig"
  35.  
  36. /* use value codes */
  37. #define    UV_ISBN    "ub"
  38. #define    CORPORATE_NAME    "uc"
  39. #define    ISSN    "us"
  40. #define    PERSONAL_NAME    "up"
  41. #define    SUBJECT    "uj"
  42. #define    TITLE    "ut"
  43. #define    GEOGRAPHIC_NAME    "ug"
  44. #define    CODEN    "ud"
  45. #define    SUBJECT_SUBDIVISION    "ue"
  46. #define    SERIES_TITLE    "uf"
  47. #define    MICROFORM_GENERATION    "uh"
  48. #define    PLACE_OF_PUBLICATION    "ui"
  49. #define    NUC_CODE    "uk"
  50. #define    LANGUAGE    "ul"
  51. #define    COMBINATION_OF_USE_VALUES    "um"
  52. #define    SYSTEM_CONTROL_NUMBER    "un"
  53. #define    DATE    "uo"
  54. #define    LC_CONTROL_NUMBER    "ur"
  55. #define    MUSIC_PUBLISHERS_NUMBER    "uu"
  56. #define    GOVERNMENT_DOCUMENTS_NUMBER    "uv"
  57. #define    SUBJECT_CLASSIFICATION    "uw"
  58. #define    RECORD_TYPE    "uy"
  59.  
  60. /* relation value codes */
  61. #define    EQUAL    "re"
  62. #define    GREATER_THAN    "rg"
  63. #define    GREATER_THAN_OR_EQUAL    "ro"
  64. #define    LESS_THAN    "rl"
  65. #define    LESS_THAN_OR_EQUAL    "rp"
  66. #define    NOT_EQUAL    "rn"
  67.  
  68. /* position value codes */
  69. #define    FIRST_IN_FIELD    "pf"
  70. #define    FIRST_IN_SUBFIELD    "ps"
  71. #define    FIRST_IN_A_SUBFIELD    "pa"
  72. #define    FIRST_IN_NOT_A_SUBFIELD    "pt"
  73. #define    ANY_POSITION_IN_FIELD    "py"
  74.  
  75. /* structure value codes */
  76. #define    PHRASE    "sp"
  77. #define    WORD    "sw"
  78. #define    KEY    "sk"
  79. #define    WORD_LIST    "sl"
  80.  
  81. /* truncation value codes */
  82. #define    NO_TRUNCATION    "tn"
  83. #define    RIGHT_TRUNCATION    "tr"
  84. #define    PROC_NUM_INCLUDED_IN_SEARCH_ARG    "ti"
  85.  
  86. /* completeness value codes */
  87. #define    INCOMPLETE_SUBFIELD    "ci"
  88. #define    COMPLETE_SUBFIELD    "cs"
  89. #define    COMPLETEFIELD    "cf"
  90.  
  91. /* operator codes */
  92. #define AND    "a"
  93. #define OR    "o"
  94. #define AND_NOT    "n"
  95.  
  96. /* term types */
  97. #define TT_Attribute        1
  98. #define    TT_ResultSetID        2
  99. #define    TT_Operator            3
  100.  
  101. #define ATTRIBUTE_SIZE        3
  102. #define OPERATOR_SIZE        2
  103.  
  104. typedef struct query_term {
  105.   /* type */
  106.   long    TermType;
  107.   /* for term */
  108.   char    Use[ATTRIBUTE_SIZE];
  109.   char    Relation[ATTRIBUTE_SIZE];
  110.   char    Position[ATTRIBUTE_SIZE];
  111.   char    Structure[ATTRIBUTE_SIZE];
  112.   char    Truncation[ATTRIBUTE_SIZE];
  113.   char    Completeness[ATTRIBUTE_SIZE];
  114.   any*    Term;
  115.   /* for result set */
  116.   any*    ResultSetID;
  117.   /* for operator */
  118.   char    Operator[OPERATOR_SIZE];
  119. } query_term;
  120.  
  121. /*----------------------------------------------------------------------*/
  122. /* functions */
  123.  
  124. #ifdef __cplusplus
  125. /* declare these as C style functions */
  126. extern "C"
  127.     {
  128. #endif /* def __cplusplus */
  129.  
  130. query_term* makeAttributeTerm _AP((
  131.         char* use,char* relation,char* position,char* structure,
  132.     char* truncation,char* completeness,any* term));
  133. query_term* makeResultSetTerm _AP((any* resultSet));
  134. query_term* makeOperatorTerm _AP((char* operatorCode));
  135. void freeTerm _AP((query_term* qt));
  136. char* writeQueryTerm _AP((query_term* qt,char* buffer,long* len));
  137. char* readQueryTerm _AP((query_term** qt,char* buffer));
  138. any* writeQuery _AP((query_term** terms));
  139. query_term** readQuery _AP((any* info));
  140.  
  141. #ifdef __cplusplus
  142.     }
  143. #endif /* def __cplusplus */
  144.  
  145. /*----------------------------------------------------------------------*/
  146.  
  147. #endif
  148.